{"nbformat":4,"nbformat_minor":0,"metadata":{"colab":{"provenance":[],"toc_visible":true,"collapsed_sections":[]},"kernelspec":{"name":"python3","display_name":"Python 3"},"language_info":{"name":"python"},"widgets":{"application/vnd.jupyter.widget-state+json":{"9888681fa7f24097a177ffb04fffe4d3":{"model_module":"@jupyter-widgets/controls","model_name":"HBoxModel","model_module_version":"1.5.0","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HBoxModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HBoxView","box_style":"","children":["IPY_MODEL_8ea2d2f55d504aeeb3bcd69b6623da54","IPY_MODEL_80ec5af80bc54fb58b7bcf3e85c09efb","IPY_MODEL_2bd3490554884f98850b3b63f2ab9e66"],"layout":"IPY_MODEL_6b8079ac596047c0a21eef3d8e13b2d2"}},"8ea2d2f55d504aeeb3bcd69b6623da54":{"model_module":"@jupyter-widgets/controls","model_name":"HTMLModel","model_module_version":"1.5.0","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HTMLView","description":"","description_tooltip":null,"layout":"IPY_MODEL_d5135f2606c642bdba4c9c8f4ac782e2","placeholder":"​","style":"IPY_MODEL_7605b0b139564081bc6c362feb85e1ab","value":"100%"}},"80ec5af80bc54fb58b7bcf3e85c09efb":{"model_module":"@jupyter-widgets/controls","model_name":"FloatProgressModel","model_module_version":"1.5.0","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"FloatProgressModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"ProgressView","bar_style":"success","description":"","description_tooltip":null,"layout":"IPY_MODEL_26d6170127a042b9a00c142eaf5b9894","max":2,"min":0,"orientation":"horizontal","style":"IPY_MODEL_93e58c48cac949d5bf166e1975dd0c84","value":2}},"2bd3490554884f98850b3b63f2ab9e66":{"model_module":"@jupyter-widgets/controls","model_name":"HTMLModel","model_module_version":"1.5.0","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HTMLView","description":"","description_tooltip":null,"layout":"IPY_MODEL_1d52c56d04224ffea66a9a626e0e8373","placeholder":"​","style":"IPY_MODEL_73917e29ce394737857796c13108bf1a","value":" 2/2 [00:09&lt;00:00,  4.19s/it]"}},"6b8079ac596047c0a21eef3d8e13b2d2":{"model_module":"@jupyter-widgets/base","model_name":"LayoutModel","model_module_version":"1.2.0","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"d5135f2606c642bdba4c9c8f4ac782e2":{"model_module":"@jupyter-widgets/base","model_name":"LayoutModel","model_module_version":"1.2.0","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"7605b0b139564081bc6c362feb85e1ab":{"model_module":"@jupyter-widgets/controls","model_name":"DescriptionStyleModel","model_module_version":"1.5.0","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"DescriptionStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","description_width":""}},"26d6170127a042b9a00c142eaf5b9894":{"model_module":"@jupyter-widgets/base","model_name":"LayoutModel","model_module_version":"1.2.0","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"93e58c48cac949d5bf166e1975dd0c84":{"model_module":"@jupyter-widgets/controls","model_name":"ProgressStyleModel","model_module_version":"1.5.0","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"ProgressStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","bar_color":null,"description_width":""}},"1d52c56d04224ffea66a9a626e0e8373":{"model_module":"@jupyter-widgets/base","model_name":"LayoutModel","model_module_version":"1.2.0","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"73917e29ce394737857796c13108bf1a":{"model_module":"@jupyter-widgets/controls","model_name":"DescriptionStyleModel","model_module_version":"1.5.0","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"DescriptionStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","description_width":""}},"78bd4d22721c44bb969b98e2e7129a0c":{"model_module":"@jupyter-widgets/controls","model_name":"HBoxModel","model_module_version":"1.5.0","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HBoxModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HBoxView","box_style":"","children":["IPY_MODEL_c140467405c74f428ebf693144e2a834","IPY_MODEL_b9e03ff22a504357be8ba002bc2be7c5","IPY_MODEL_895e5eed9a9142ccbad80624a68e1a66"],"layout":"IPY_MODEL_7c424870cdbf4a3a8a04366a17778ebf"}},"c140467405c74f428ebf693144e2a834":{"model_module":"@jupyter-widgets/controls","model_name":"HTMLModel","model_module_version":"1.5.0","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HTMLView","description":"","description_tooltip":null,"layout":"IPY_MODEL_a4a5da15394a47deb179d075b329702f","placeholder":"​","style":"IPY_MODEL_93830905ec6f4824868fbae33af4068a","value":"100%"}},"b9e03ff22a504357be8ba002bc2be7c5":{"model_module":"@jupyter-widgets/controls","model_name":"FloatProgressModel","model_module_version":"1.5.0","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"FloatProgressModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"ProgressView","bar_style":"success","description":"","description_tooltip":null,"layout":"IPY_MODEL_bdd0b4acf853474183694a418185a9f1","max":2,"min":0,"orientation":"horizontal","style":"IPY_MODEL_46dbcd0c12414e2c8219eb6b290cbca7","value":2}},"895e5eed9a9142ccbad80624a68e1a66":{"model_module":"@jupyter-widgets/controls","model_name":"HTMLModel","model_module_version":"1.5.0","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HTMLView","description":"","description_tooltip":null,"layout":"IPY_MODEL_103d4a134bec49278050c6f9db57766b","placeholder":"​","style":"IPY_MODEL_5215f7c7f84447f58d07f186f939d08f","value":" 2/2 [00:16&lt;00:00,  7.44s/it]"}},"7c424870cdbf4a3a8a04366a17778ebf":{"model_module":"@jupyter-widgets/base","model_name":"LayoutModel","model_module_version":"1.2.0","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"a4a5da15394a47deb179d075b329702f":{"model_module":"@jupyter-widgets/base","model_name":"LayoutModel","model_module_version":"1.2.0","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"93830905ec6f4824868fbae33af4068a":{"model_module":"@jupyter-widgets/controls","model_name":"DescriptionStyleModel","model_module_version":"1.5.0","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"DescriptionStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","description_width":""}},"bdd0b4acf853474183694a418185a9f1":{"model_module":"@jupyter-widgets/base","model_name":"LayoutModel","model_module_version":"1.2.0","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"46dbcd0c12414e2c8219eb6b290cbca7":{"model_module":"@jupyter-widgets/controls","model_name":"ProgressStyleModel","model_module_version":"1.5.0","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"ProgressStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","bar_color":null,"description_width":""}},"103d4a134bec49278050c6f9db57766b":{"model_module":"@jupyter-widgets/base","model_name":"LayoutModel","model_module_version":"1.2.0","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"5215f7c7f84447f58d07f186f939d08f":{"model_module":"@jupyter-widgets/controls","model_name":"DescriptionStyleModel","model_module_version":"1.5.0","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"DescriptionStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","description_width":""}},"7a90baba43fb4c8e89fb7dc3b0cdf3bd":{"model_module":"@jupyter-widgets/controls","model_name":"HBoxModel","model_module_version":"1.5.0","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HBoxModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HBoxView","box_style":"","children":["IPY_MODEL_946e16ab864d4bb08b038ad8e3b4ed3c","IPY_MODEL_255e861f1f7e49aaba613e0d9bbe8b37","IPY_MODEL_9ebb4687c2614c27826f0cca14796602"],"layout":"IPY_MODEL_4c5c3c109f344154a72acd42b0e23c6a"}},"946e16ab864d4bb08b038ad8e3b4ed3c":{"model_module":"@jupyter-widgets/controls","model_name":"HTMLModel","model_module_version":"1.5.0","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HTMLView","description":"","description_tooltip":null,"layout":"IPY_MODEL_5a7405f26611412a910686c353fd536f","placeholder":"​","style":"IPY_MODEL_806d8091e4e743f0a1eb5adc9354a4fb","value":"100%"}},"255e861f1f7e49aaba613e0d9bbe8b37":{"model_module":"@jupyter-widgets/controls","model_name":"FloatProgressModel","model_module_version":"1.5.0","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"FloatProgressModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"ProgressView","bar_style":"success","description":"","description_tooltip":null,"layout":"IPY_MODEL_ab2a9009d1d749fdba4aec615db13434","max":2,"min":0,"orientation":"horizontal","style":"IPY_MODEL_f5d599b06edb4619bae99a61816d1f1e","value":2}},"9ebb4687c2614c27826f0cca14796602":{"model_module":"@jupyter-widgets/controls","model_name":"HTMLModel","model_module_version":"1.5.0","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HTMLView","description":"","description_tooltip":null,"layout":"IPY_MODEL_e705cb4b600144c29fa02434c294c05b","placeholder":"​","style":"IPY_MODEL_09bcc5ae2c084caca04d1266ed6722c9","value":" 2/2 [00:19&lt;00:00,  9.24s/it]"}},"4c5c3c109f344154a72acd42b0e23c6a":{"model_module":"@jupyter-widgets/base","model_name":"LayoutModel","model_module_version":"1.2.0","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"5a7405f26611412a910686c353fd536f":{"model_module":"@jupyter-widgets/base","model_name":"LayoutModel","model_module_version":"1.2.0","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"806d8091e4e743f0a1eb5adc9354a4fb":{"model_module":"@jupyter-widgets/controls","model_name":"DescriptionStyleModel","model_module_version":"1.5.0","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"DescriptionStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","description_width":""}},"ab2a9009d1d749fdba4aec615db13434":{"model_module":"@jupyter-widgets/base","model_name":"LayoutModel","model_module_version":"1.2.0","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"f5d599b06edb4619bae99a61816d1f1e":{"model_module":"@jupyter-widgets/controls","model_name":"ProgressStyleModel","model_module_version":"1.5.0","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"ProgressStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","bar_color":null,"description_width":""}},"e705cb4b600144c29fa02434c294c05b":{"model_module":"@jupyter-widgets/base","model_name":"LayoutModel","model_module_version":"1.2.0","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"09bcc5ae2c084caca04d1266ed6722c9":{"model_module":"@jupyter-widgets/controls","model_name":"DescriptionStyleModel","model_module_version":"1.5.0","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"DescriptionStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","description_width":""}},"39117492fa5641e5b4891091d335f459":{"model_module":"@jupyter-widgets/controls","model_name":"HBoxModel","model_module_version":"1.5.0","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HBoxModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HBoxView","box_style":"","children":["IPY_MODEL_c304de8a1b00441cb23e53df92a439c9","IPY_MODEL_7d186b73c8544b1fbea1f261757cdcf5","IPY_MODEL_1e4f1fc2acb6442a9222b62e9c7e0646"],"layout":"IPY_MODEL_43ab3edf9e6b44f49e0991a191508e5f"}},"c304de8a1b00441cb23e53df92a439c9":{"model_module":"@jupyter-widgets/controls","model_name":"HTMLModel","model_module_version":"1.5.0","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HTMLView","description":"","description_tooltip":null,"layout":"IPY_MODEL_73bad1a2113a472b80c6097ef975dad0","placeholder":"​","style":"IPY_MODEL_0b446c49d9ad47a0a21fbe521c87fc7e","value":"100%"}},"7d186b73c8544b1fbea1f261757cdcf5":{"model_module":"@jupyter-widgets/controls","model_name":"FloatProgressModel","model_module_version":"1.5.0","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"FloatProgressModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"ProgressView","bar_style":"success","description":"","description_tooltip":null,"layout":"IPY_MODEL_e49b61488f9d48308239976aa49a7745","max":2,"min":0,"orientation":"horizontal","style":"IPY_MODEL_ff111b88dfd6436dacd3b5e812a73a94","value":2}},"1e4f1fc2acb6442a9222b62e9c7e0646":{"model_module":"@jupyter-widgets/controls","model_name":"HTMLModel","model_module_version":"1.5.0","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HTMLView","description":"","description_tooltip":null,"layout":"IPY_MODEL_68f0b6cf2c184261ad2f75485d805cca","placeholder":"​","style":"IPY_MODEL_0bb9cd7927484b92b6981f494ce8f447","value":" 2/2 [00:14&lt;00:00,  6.82s/it]"}},"43ab3edf9e6b44f49e0991a191508e5f":{"model_module":"@jupyter-widgets/base","model_name":"LayoutModel","model_module_version":"1.2.0","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"73bad1a2113a472b80c6097ef975dad0":{"model_module":"@jupyter-widgets/base","model_name":"LayoutModel","model_module_version":"1.2.0","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"0b446c49d9ad47a0a21fbe521c87fc7e":{"model_module":"@jupyter-widgets/controls","model_name":"DescriptionStyleModel","model_module_version":"1.5.0","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"DescriptionStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","description_width":""}},"e49b61488f9d48308239976aa49a7745":{"model_module":"@jupyter-widgets/base","model_name":"LayoutModel","model_module_version":"1.2.0","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"ff111b88dfd6436dacd3b5e812a73a94":{"model_module":"@jupyter-widgets/controls","model_name":"ProgressStyleModel","model_module_version":"1.5.0","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"ProgressStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","bar_color":null,"description_width":""}},"68f0b6cf2c184261ad2f75485d805cca":{"model_module":"@jupyter-widgets/base","model_name":"LayoutModel","model_module_version":"1.2.0","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"0bb9cd7927484b92b6981f494ce8f447":{"model_module":"@jupyter-widgets/controls","model_name":"DescriptionStyleModel","model_module_version":"1.5.0","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"DescriptionStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","description_width":""}},"32f4011005b14486bdeccf2603e28981":{"model_module":"@jupyter-widgets/controls","model_name":"HBoxModel","model_module_version":"1.5.0","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HBoxModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HBoxView","box_style":"","children":["IPY_MODEL_43fe80b069814cc38e8e0fcf3128dd8e","IPY_MODEL_97686f39da2441d590fe2c33f4849aa6","IPY_MODEL_cb764eda4d984f1ea05b58b5e2af4f2c"],"layout":"IPY_MODEL_c0b8ce66baf64dc7a4e07d42e753ae75"}},"43fe80b069814cc38e8e0fcf3128dd8e":{"model_module":"@jupyter-widgets/controls","model_name":"HTMLModel","model_module_version":"1.5.0","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HTMLView","description":"","description_tooltip":null,"layout":"IPY_MODEL_f92df179ceb541fc8db4d70419130209","placeholder":"​","style":"IPY_MODEL_e8ade12c33b64816af58f1b073fca8ac","value":"100%"}},"97686f39da2441d590fe2c33f4849aa6":{"model_module":"@jupyter-widgets/controls","model_name":"FloatProgressModel","model_module_version":"1.5.0","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"FloatProgressModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"ProgressView","bar_style":"success","description":"","description_tooltip":null,"layout":"IPY_MODEL_67fca3f587be4150af4a56b2f6abfacb","max":2,"min":0,"orientation":"horizontal","style":"IPY_MODEL_e6f2884f826746c7bda751b272ad5842","value":2}},"cb764eda4d984f1ea05b58b5e2af4f2c":{"model_module":"@jupyter-widgets/controls","model_name":"HTMLModel","model_module_version":"1.5.0","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HTMLView","description":"","description_tooltip":null,"layout":"IPY_MODEL_6e2ea7cfb28d40c59e3d0b26660cbd61","placeholder":"​","style":"IPY_MODEL_e7ac3fd64a15441aa9eb93e7aab91e04","value":" 2/2 [00:23&lt;00:00, 10.64s/it]"}},"c0b8ce66baf64dc7a4e07d42e753ae75":{"model_module":"@jupyter-widgets/base","model_name":"LayoutModel","model_module_version":"1.2.0","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"f92df179ceb541fc8db4d70419130209":{"model_module":"@jupyter-widgets/base","model_name":"LayoutModel","model_module_version":"1.2.0","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"e8ade12c33b64816af58f1b073fca8ac":{"model_module":"@jupyter-widgets/controls","model_name":"DescriptionStyleModel","model_module_version":"1.5.0","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"DescriptionStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","description_width":""}},"67fca3f587be4150af4a56b2f6abfacb":{"model_module":"@jupyter-widgets/base","model_name":"LayoutModel","model_module_version":"1.2.0","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"e6f2884f826746c7bda751b272ad5842":{"model_module":"@jupyter-widgets/controls","model_name":"ProgressStyleModel","model_module_version":"1.5.0","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"ProgressStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","bar_color":null,"description_width":""}},"6e2ea7cfb28d40c59e3d0b26660cbd61":{"model_module":"@jupyter-widgets/base","model_name":"LayoutModel","model_module_version":"1.2.0","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"e7ac3fd64a15441aa9eb93e7aab91e04":{"model_module":"@jupyter-widgets/controls","model_name":"DescriptionStyleModel","model_module_version":"1.5.0","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"DescriptionStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","description_width":""}},"b0561d4d8fc24dc7be9ec7fc8344dd6f":{"model_module":"@jupyter-widgets/controls","model_name":"HBoxModel","model_module_version":"1.5.0","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HBoxModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HBoxView","box_style":"","children":["IPY_MODEL_5ada3ad570da45b5b6670b930975c9ed","IPY_MODEL_60b43948dd83429b9c2fca2f4dddeab8","IPY_MODEL_5f9df26f553749729e1247be660012c7"],"layout":"IPY_MODEL_c3ca95c367f84e1b9ba15f44c57eaf52"}},"5ada3ad570da45b5b6670b930975c9ed":{"model_module":"@jupyter-widgets/controls","model_name":"HTMLModel","model_module_version":"1.5.0","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HTMLView","description":"","description_tooltip":null,"layout":"IPY_MODEL_78243a6142284aff86746a3d8ae35a98","placeholder":"​","style":"IPY_MODEL_1be9e09560964f0a8255c6d9c0848c45","value":"100%"}},"60b43948dd83429b9c2fca2f4dddeab8":{"model_module":"@jupyter-widgets/controls","model_name":"FloatProgressModel","model_module_version":"1.5.0","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"FloatProgressModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"ProgressView","bar_style":"success","description":"","description_tooltip":null,"layout":"IPY_MODEL_c4038bf5c6674e27ab3993b81c439dc6","max":2,"min":0,"orientation":"horizontal","style":"IPY_MODEL_ec703d0f31e54cb9a68e7fbecdec40a9","value":2}},"5f9df26f553749729e1247be660012c7":{"model_module":"@jupyter-widgets/controls","model_name":"HTMLModel","model_module_version":"1.5.0","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HTMLView","description":"","description_tooltip":null,"layout":"IPY_MODEL_0a96aa3995154ceabd1efb7d06c2684a","placeholder":"​","style":"IPY_MODEL_96c94911cbfa43f9b846296ca82959e9","value":" 2/2 [00:15&lt;00:00,  7.25s/it]"}},"c3ca95c367f84e1b9ba15f44c57eaf52":{"model_module":"@jupyter-widgets/base","model_name":"LayoutModel","model_module_version":"1.2.0","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"78243a6142284aff86746a3d8ae35a98":{"model_module":"@jupyter-widgets/base","model_name":"LayoutModel","model_module_version":"1.2.0","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"1be9e09560964f0a8255c6d9c0848c45":{"model_module":"@jupyter-widgets/controls","model_name":"DescriptionStyleModel","model_module_version":"1.5.0","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"DescriptionStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","description_width":""}},"c4038bf5c6674e27ab3993b81c439dc6":{"model_module":"@jupyter-widgets/base","model_name":"LayoutModel","model_module_version":"1.2.0","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"ec703d0f31e54cb9a68e7fbecdec40a9":{"model_module":"@jupyter-widgets/controls","model_name":"ProgressStyleModel","model_module_version":"1.5.0","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"ProgressStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","bar_color":null,"description_width":""}},"0a96aa3995154ceabd1efb7d06c2684a":{"model_module":"@jupyter-widgets/base","model_name":"LayoutModel","model_module_version":"1.2.0","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"96c94911cbfa43f9b846296ca82959e9":{"model_module":"@jupyter-widgets/controls","model_name":"DescriptionStyleModel","model_module_version":"1.5.0","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"DescriptionStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","description_width":""}}}}},"cells":[{"cell_type":"markdown","source":["Copyright 2022 Google LLC. SPDX-License-Identifier: Apache-2.0\n","\n","Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at\n","\n","https://www.apache.org/licenses/LICENSE-2.0\n","\n","Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License."],"metadata":{"id":"wC8oCd52Fr5x"}},{"cell_type":"markdown","source":["# Experiment: Reasoning with Code vs. Language\n","\n","This notebook is a part of the open-source code release associated with the paper:\n","\n","[Code as Policies: Language Model Programs for Embodied Control](https://code-as-policies.github.io/)\n","\n","This notebook gives results corresponding to Section IV.A and Table I in the paper.\n","\n","1) Please obtain an OpenAI API Key here:\n","https://openai.com/blog/openai-api/\n","\n","2) Gain Codex access by joining the waitlist here:\n","https://openai.com/blog/openai-codex/\n","\n","Once you have Codex access you can use `code-davinci-002` as the `model_name`. Using the GPT-3 model (`text-dainvci-002`) is also ok, but performance won't be as good (there will be more code logic errors)."],"metadata":{"id":"5-IFdOq7Fubm"}},{"cell_type":"code","source":["openai_api_key = 'YOUR KEY HERE'\n","model_name = 'code-davinci-002' # 'text-davinci-002'"],"metadata":{"id":"2dSVHK_3Hl5y"},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":["# Setup"],"metadata":{"id":"VObMJL8C1Trc"}},{"cell_type":"code","source":["! pip install numpy scipy shapely openai pygments > /dev/null 2>&1\n","\n","import openai\n","openai.api_key = openai_api_key"],"metadata":{"id":"kCOgxpW61UZE"},"execution_count":null,"outputs":[]},{"cell_type":"code","source":["from copy import copy\n","from tqdm.auto import trange\n","from time import sleep\n","\n","import ast\n","import astunparse\n","\n","from pygments import highlight\n","from pygments.lexers import PythonLexer\n","from pygments.formatters import TerminalFormatter\n","\n","def exec_safe(code_str, gvars=None, lvars=None):\n","  banned_phrases = ['import', '__']\n","  for phrase in banned_phrases:\n","    assert phrase not in code_str\n","\n","  if gvars is None:\n","    gvars = {}\n","  if lvars is None:\n","    lvars = {}\n","  \n","  empty_fn = lambda *args, **kwargs: None\n","  custom_gvars = merge_dicts([\n","      gvars,\n","      {'exec': empty_fn, 'eval': empty_fn}\n","  ])\n","  exec(code_str, custom_gvars, lvars)\n","\n","def eval_safe(code_str, gvars=None, lvars=None):\n","  banned_phrases = ['import', '__']\n","  for phrase in banned_phrases:\n","    assert phrase not in code_str\n","\n","  if gvars is None:\n","    gvars = {}\n","  if lvars is None:\n","    lvars = {}\n","  \n","  empty_fn = lambda *args, **kwargs: None\n","  custom_gvars = merge_dicts([\n","      gvars,\n","      {'exec': empty_fn, 'eval': empty_fn}\n","  ])\n","  return eval(code_str, custom_gvars, lvars)\n","\n","default_query_kwargs = {\n","    'engine': model_name,\n","    'max_tokens': 512,\n","    'temperature': 0,\n","}\n","\n","def lmp_batch(base_prompt, cmds, stop_tokens=None, strip=False, batch_size=20, rate_limit_time=5, query_kwargs=None):\n","    prompts = [\n","      f'{base_prompt}\\n{cmd}'\n","      for cmd in cmds\n","    ]\n","\n","    use_query_kwargs = copy(default_query_kwargs)\n","    if query_kwargs is not None:\n","      use_query_kwargs.update(query_kwargs)\n","\n","    responses = []\n","    for start_idx in trange(0, len(prompts), batch_size):\n","        end_idx = min(start_idx + batch_size, len(prompts))\n","        batch_prompts = prompts[start_idx : end_idx]\n","\n","        raw_responses_batch = openai.Completion.create(\n","            prompt=batch_prompts, stop=stop_tokens, **use_query_kwargs\n","        )\n","        responses_batch = [\n","            r['text']\n","            for r in raw_responses_batch['choices']\n","        ]\n","\n","        if strip:\n","            responses_batch = [response.strip() for response in responses_batch]\n","        \n","        responses.extend(responses_batch)\n","\n","        if end_idx != len(prompts):\n","            sleep(rate_limit_time)\n","\n","    return responses\n","\n","def lmp(base_prompt, query, stop_tokens=None, log=True, return_response=False, query_kwargs=None):\n","    new_prompt = f'{base_prompt}\\n{query}'\n","    use_query_kwargs = copy(default_query_kwargs)\n","    if query_kwargs is not None:\n","      use_query_kwargs.update(query_kwargs)\n","    response = openai.Completion.create(\n","        prompt=new_prompt, stop=stop_tokens, **use_query_kwargs\n","    )['choices'][0]['text'].strip()\n","\n","    if log:\n","      print(query)\n","      print(response)\n","\n","    if return_response:\n","      return response\n","\n","def merge_dicts(dicts):\n","    return {\n","        k : v \n","        for d in dicts\n","        for k, v in d.items()\n","    }\n","\n","def create_new_fs_from_code(prompt_f_gen, code_str, context_vars, return_src=False):\n","    fs, f_assigns = {}, {}\n","    f_parser = FunctionParser(fs, f_assigns)\n","    f_parser.visit(ast.parse(code_str))\n","    for f_name, f_assign in f_assigns.items():\n","        if f_name in fs:\n","            fs[f_name] = f_assign\n","\n","    new_fs = {}\n","    srcs = {}\n","    for f_name, f_sig in fs.items():\n","        all_vars = merge_dicts([context_vars, new_fs])\n","        if not var_exists(f_name, all_vars):\n","            f, f_src = lmp_fgen(prompt_f_gen, f_name, f_sig, recurse=True, context_vars=all_vars, return_src=True)\n","\n","            new_fs[f_name], srcs[f_name] = f, f_src\n","\n","    if return_src:\n","        return new_fs, srcs\n","    return new_fs\n","\n","def lmp_fgen(prompt, f_name, f_sig, stop_tokens=['# define function:', '# example:'], recurse=False, \n","             context_vars=None, bug_fix=False, log=True, return_src=False, query_kwargs=None, info=''):\n","    query = f'# define function: {f_sig}.'\n","    if info:\n","      query = f'{query}\\n# info: {info}.'\n","    f_src = lmp(prompt, query, stop_tokens=stop_tokens, log=False, return_response=True, query_kwargs=query_kwargs)\n","    if bug_fix:\n","        f_src = openai.Edit.create(\n","          model='code-davinci-edit-001',\n","          input='# ' + f_src,\n","          temperature=0,\n","          instruction=\"Fix the bug if there is one. Improve readability. Keep same inputs and outputs. Only small changes. No comments.\",\n","        )['choices'][0]['text'].strip()\n","\n","    if context_vars is None:\n","        context_vars = {}\n","    gvars = context_vars\n","    lvars = {}\n","\n","    f_success = True\n","    try:\n","      exec_safe(f_src, gvars, lvars)\n","      f = lvars[f_name]\n","    except Exception as e:\n","      print(e)\n","      f = lambda *args, **kargs: None\n","      f_success = False \n","\n","    if recurse and f_success:\n","      f_def_body = astunparse.unparse(ast.parse(f_src).body[0].body)\n","      child_fs, child_f_srcs = create_new_fs_from_code(prompt_f_gen, f_def_body, context_vars, return_src=True)\n","      \n","      if len(child_fs) > 0:\n","        # redefine parent f so newly created child_fs are in scope\n","        gvars = merge_dicts([context_vars, child_fs])\n","        lvars = {}\n","      \n","        exec_safe(f_src, gvars, lvars)\n","        \n","        f = lvars[f_name]\n","\n","    if log:\n","        to_print = highlight(f'{query}\\n{f_src}', PythonLexer(), TerminalFormatter())\n","        print(f'LMP FGEN created:\\n\\n{to_print}\\n')\n","\n","    if return_src:\n","        return f, f_src\n","    return f\n","\n","class FunctionParser(ast.NodeTransformer):\n","\n","    def __init__(self, fs, f_assigns):\n","      super().__init__()\n","      self._fs = fs\n","      self._f_assigns = f_assigns\n","\n","    def visit_Call(self, node):\n","        self.generic_visit(node)\n","        if isinstance(node.func, ast.Name):\n","            f_sig = astunparse.unparse(node).strip()\n","            f_name = astunparse.unparse(node.func).strip()\n","            self._fs[f_name] = f_sig\n","        return node\n","\n","    def visit_Assign(self, node):\n","        self.generic_visit(node)\n","        if isinstance(node.value, ast.Call):\n","            assign_str = astunparse.unparse(node).strip()\n","            f_name = astunparse.unparse(node.value.func).strip()\n","            self._f_assigns[f_name] = assign_str\n","        return node\n","\n","def var_exists(name, all_vars):\n","    try:\n","        eval(name, all_vars)\n","    except:\n","        exists = False\n","    else:\n","        exists = True\n","    return exists"],"metadata":{"id":"5DxXPVOW1VkG"},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":["# Task: Select Object by Spatial Descriptions"],"metadata":{"id":"VLd4cVQ21tK8"}},{"cell_type":"markdown","source":["## Setup"],"metadata":{"id":"4tkVwxbiA3v9"}},{"cell_type":"code","source":["query_setting_short = \"objects = ['cyan bowl', 'red bowl', 'blue bowl', 'red block', 'cyan block', 'blue block']\"\n","\n","def get_obj_pos(name):\n","  return {\n","      'cyan bowl': np.array([0.5, 0.2]),\n","      'red bowl': np.array((0.2, 0.7)),\n","      'blue bowl': np.array((0.7, 0.5)),\n","      'red block': np.array((0.5, 0.25)),\n","      'cyan block': np.array((0.1, 0.8)),\n","      'blue block': np.array((0.3, 0.2)),\n","  }[name]\n","\n","query_setting = '''\n","Setting: Objects and their positions are:\n","  - cyan bowl, (0.5, 0.2)\n","  - red bowl, (0.2, 0.7)\n","  - blue bowl, (0.7, 0.5)\n","  - red block, (0.5, 0.25)\n","  - cyan block, (0.1, 0.8)\n","  - blue block, (0.3, 0.2)\n","'''.strip()\n","\n","questions_short = [\n","    'the top-most bowl',\n","    'the bottom-most bowl',\n","    'the left-most bowl',\n","    'the right-most bowl',\n","    'the top-most block',\n","    'the bottom-most block',\n","    'the left-most block',\n","    'the right-most block',\n","    'the second bowl from the right',\n","    'the second bowl from the left',\n","    'the second bowl from the top',\n","    'the second bowl from the bottom',\n","    'the second block from the right',\n","    'the second block from the left',\n","    'the second block from the top',\n","    'the second block from the bottom',\n","    'the block closest to the blue bowl',\n","    'the block closest from the red bowl',\n","    'the block closest to the cyan bowl',\n","    'the block farthest to the blue bowl',\n","    'the block farthest from the red bowl',\n","    'the block farthest to the cyan bowl',\n","    'the bowl closest to the blue block',\n","    'the bowl closest from the red block',\n","    'the bowl closest to the cyan block',\n","    'the bowl farthest to the blue block',\n","    'the bowl farthest from the red block',\n","    'the bowl farthest to the cyan block',\n","]\n","\n","questions = [f'What is {q}?' for q in questions_short]\n","\n","answers = [\n","    'red bowl', 'cyan bowl', 'red bowl', 'blue bowl',\n","    'cyan block', 'blue block', 'cyan block', 'red block',\n","    'cyan bowl', 'cyan bowl', 'blue bowl', 'blue bowl',\n","    'blue block', 'blue block', 'red block', 'red block',\n","    'red block', 'cyan block', 'red block',\n","    'cyan block', 'red block', 'cyan block', \n","    'cyan bowl', 'cyan bowl', 'red bowl', \n","    'red bowl', 'red bowl', 'cyan bowl'\n","]\n","\n","import numpy as np\n","\n","def eval_questions_lmp(prompt, query_setting_short, questions_short, answers, context_vars):\n","  queries = [\n","      f'{query_setting_short}\\n# {question}.'\n","      for question in questions_short\n","  ]\n","  resps = lmp_batch(\n","      prompt,\n","      queries,\n","      strip=True,\n","      stop_tokens=['objects = [', '#']\n","  )\n","\n","  pred_answers = []\n","  for resp in resps:\n","    lvars = {}\n","    exec_safe(resp, context_vars, lvars)\n","    pred_answers.append(lvars['ret_val'])\n","\n","  successes = []\n","  for resp, answer, pred_answer in zip(resps, answers, pred_answers):\n","    successes.append(pred_answer == answer)\n","  return successes, pred_answers, resps\n","\n","def eval_questions_language(prompt, query_setting, questions, answers):\n","  queries = [\n","      f'{query_setting}\\nQuestion: {question}'\n","      for question in questions\n","  ]\n","  resps = lmp_batch(\n","      prompt,\n","      queries,\n","      strip=True,\n","      stop_tokens=['Setting: ', 'Question: '],\n","  )\n","  successes = []\n","  pred_answers = []\n","  for resp, answer in zip(resps, answers):\n","    pred_answer = resp[resp.find('Answer: ') + len('Answer: '):]\n","    successes.append(pred_answer == answer)\n","    pred_answers.append(pred_answer)\n","  return successes, pred_answers, resps"],"metadata":{"id":"-w1p6AnvAl40"},"execution_count":null,"outputs":[]},{"cell_type":"code","source":["print(len(questions))"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"rNQtlXBUKvMC","executionInfo":{"status":"ok","timestamp":1660658078827,"user_tz":240,"elapsed":4,"user":{"displayName":"Jacky Liang","userId":"05524594537381871813"}},"outputId":"ce6a98b2-68c7-445a-f0d3-cc5927e3e93b"},"execution_count":null,"outputs":[{"output_type":"stream","name":"stdout","text":["28\n"]}]},{"cell_type":"markdown","source":["## Direct Language"],"metadata":{"id":"FGvMXIsM7hIN"}},{"cell_type":"code","source":["prompt_parse_obj_name_nl = '''\n","Setting: Objects and their positions are: \n","  - blue block, (0, 0)\n","  - cyan block, (0.1, 0)\n","  - purple bowl, (0, 0.2)\n","  - gray bowl, (0.3, 0.4)\n","  - brown bowl, (0.5, 0.2)\n","  - purple block, (0.8, 0)\n","Question: What is the block closest to the purple bowl?\n","Answer: blue block\n","Setting: Objects and their positions are:\n","  - brown bowl, (1, 0.5)\n","  - green block, (0.6, 0.8)\n","  - brown block, (0.32, 0.48)\n","  - green bowl, (0.1, 0.2)\n","  - blue bowl, (0.5, 0.5)\n","  - blue block, (0.4, 0.7)\n","Question: What is the left most block?\n","Answer: brown block\n","Setting: Objects and their positions are:\n","  - brown bowl, (0.2, 0.3)\n","  - green block, (0.2, 0.35)\n","  - brown block, (0.1, 0.9)\n","  - green bowl, (0.4, 0.7)\n","  - blue bowl, (0.9, 0.2)\n","  - blue block, (0.7, 0.3)\n","Question: What is the bowl near the top?\n","Answer: green bowl\n","'''"],"metadata":{"id":"9LoFy4IE7jwm"},"execution_count":null,"outputs":[]},{"cell_type":"code","source":["successes, pred_answers, resps = eval_questions_language(prompt_parse_obj_name_nl, query_setting, questions, answers)\n","print('Success Rate: ', np.mean(successes))\n","# print('Failures')\n","# for s, q, r, pa, a in zip(successes, questions_short, resps, pred_answers, answers):\n","#   if not s:\n","#     print(q)\n","#     print(r)\n","#     print(pa, a)\n","#     print()"],"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":66,"referenced_widgets":["9888681fa7f24097a177ffb04fffe4d3","8ea2d2f55d504aeeb3bcd69b6623da54","80ec5af80bc54fb58b7bcf3e85c09efb","2bd3490554884f98850b3b63f2ab9e66","6b8079ac596047c0a21eef3d8e13b2d2","d5135f2606c642bdba4c9c8f4ac782e2","7605b0b139564081bc6c362feb85e1ab","26d6170127a042b9a00c142eaf5b9894","93e58c48cac949d5bf166e1975dd0c84","1d52c56d04224ffea66a9a626e0e8373","73917e29ce394737857796c13108bf1a"]},"id":"WNOCk5Op71jf","executionInfo":{"status":"ok","timestamp":1660578716498,"user_tz":240,"elapsed":9408,"user":{"displayName":"Jacky Liang","userId":"05524594537381871813"}},"outputId":"d63206b9-754a-458d-f613-06c6a5bcc394"},"execution_count":null,"outputs":[{"output_type":"display_data","data":{"text/plain":["  0%|          | 0/2 [00:00<?, ?it/s]"],"application/vnd.jupyter.widget-view+json":{"version_major":2,"version_minor":0,"model_id":"9888681fa7f24097a177ffb04fffe4d3"}},"metadata":{}},{"output_type":"stream","name":"stdout","text":["Success Rate:  0.39285714285714285\n"]}]},{"cell_type":"markdown","source":["## Chain of Thought"],"metadata":{"id":"_bpjTurQ7dFR"}},{"cell_type":"code","source":["prompt_parse_obj_name_cot = '''\n","Setting: Objects and their positions are: \n","  - blue block, (0, 0)\n","  - cyan block, (0.1, 0)\n","  - purple bowl, (0, 0.2)\n","  - gray bowl, (0.3, 0.4)\n","  - brown bowl, (0.5, 0.2)\n","  - purple block, (0.8, 0)\n","Question: What is the block closest to the purple bowl?\n","Thought: The blocks and their positions are:\n","  - blue block, (0, 0)\n","  - cyan block, (0.1, 0)\n","  - purple block, (0.8, 0)\n","Thought: Their distances to the purple bowl are:\n","  - blue block, 0.2\n","  - cyan block, 0.2236\n","  - purple block, 0.8246\n","Thought: Therefore, the block closest to the purple bowl is the blue block.\n","Answer: blue block\n","Setting: Objects and their positions are:\n","  - brown bowl, (1, 0.5)\n","  - green block, (0.6, 0.8)\n","  - brown block, (0.32, 0.48)\n","  - green bowl, (0.1, 0.2)\n","  - blue bowl, (0.5, 0.5)\n","  - blue block, (0.4, 0.7)\n","Question: What is the left most block?\n","Thought: The blocks and their x coordinates are:\n","  - green block, 0.6\n","  - brown block, 0.32\n","  - blue block, 0.4\n","Thought: The block with the minimum x coordinate is the brown block.\n","Answer: brown block\n","Setting: Objects and their positions are:\n","  - brown bowl, (0.2, 0.3)\n","  - green block, (0.2, 0.35)\n","  - brown block, (0.1, 0.9)\n","  - green bowl, (0.4, 0.7)\n","  - blue bowl, (0.9, 0.2)\n","  - blue block, (0.7, 0.3)\n","Question: What is the bowl near the top?\n","Thought: The bowls and their y coordinates are:\n","  - brown bowl, 0.3\n","  - green bowl, 0.7\n","  - blue bowl, 0.2\n","Thought: The bowl with the highest y coordinate is the green bowl.\n","Answer: green bowl\n","'''"],"metadata":{"id":"e9WUNBqe7do8"},"execution_count":null,"outputs":[]},{"cell_type":"code","source":["successes, pred_answers, resps = eval_questions_language(prompt_parse_obj_name_cot, query_setting, questions, answers)\n","print('Success Rate: ', np.mean(successes))\n","# print('Failures')\n","# for s, q, r, pa, a in zip(successes, questions_short, resps, pred_answers, answers):\n","#   if not s:\n","#     print(q)\n","#     print(r)\n","#     print(pa, a)\n","#     print()"],"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":66,"referenced_widgets":["78bd4d22721c44bb969b98e2e7129a0c","c140467405c74f428ebf693144e2a834","b9e03ff22a504357be8ba002bc2be7c5","895e5eed9a9142ccbad80624a68e1a66","7c424870cdbf4a3a8a04366a17778ebf","a4a5da15394a47deb179d075b329702f","93830905ec6f4824868fbae33af4068a","bdd0b4acf853474183694a418185a9f1","46dbcd0c12414e2c8219eb6b290cbca7","103d4a134bec49278050c6f9db57766b","5215f7c7f84447f58d07f186f939d08f"]},"id":"DdFUYT095NYf","executionInfo":{"status":"ok","timestamp":1660578732967,"user_tz":240,"elapsed":16482,"user":{"displayName":"Jacky Liang","userId":"05524594537381871813"}},"outputId":"eb582c14-ac8d-4452-e83f-2d760bdfe1b0"},"execution_count":null,"outputs":[{"output_type":"display_data","data":{"text/plain":["  0%|          | 0/2 [00:00<?, ?it/s]"],"application/vnd.jupyter.widget-view+json":{"version_major":2,"version_minor":0,"model_id":"78bd4d22721c44bb969b98e2e7129a0c"}},"metadata":{}},{"output_type":"stream","name":"stdout","text":["Success Rate:  0.6785714285714286\n"]}]},{"cell_type":"markdown","source":["## LMP"],"metadata":{"id":"mk65EGG5A51H"}},{"cell_type":"code","source":["prompt_parse_obj_name_lmp = '''\n","import numpy as np\n","from env_utils import get_obj_pos\n","\n","objects = ['blue block', 'cyan block', 'purple bowl', 'gray bowl', 'brown bowl', 'pink block', 'purple block']\n","# the block closest to the purple bowl.\n","block_names = ['blue block', 'cyan block', 'purple block']\n","block_positions = np.array([get_obj_pos(block_name) for block_name in block_names])\n","closest_block_idx = np.argmin(np.linalg.norm(block_positions - get_obj_pos('purple bowl'), axis=1))\n","closest_block_name = block_names[closest_block_idx]\n","ret_val = closest_block_name\n","objects = ['brown bowl', 'green block', 'brown block', 'green bowl', 'blue bowl', 'blue block']\n","# the left most block.\n","block_names = ['green block', 'brown block', 'blue block']\n","block_positions = np.array([get_obj_pos(block_name) for block_name in block_names])\n","left_block_idx = np.argmin(block_positions[:, 0])\n","left_block_name = block_names[left_block_idx]\n","ret_val = left_block_name\n","objects = ['brown bowl', 'green block', 'brown block', 'green bowl', 'blue bowl', 'blue block']\n","# the bowl on near the top.\n","bowl_names = ['brown bowl', 'green bowl', 'blue bowl']\n","bowl_positions = np.array([get_obj_pos(bowl_name) for bowl_name in bowl_names])\n","top_bowl_idx = np.argmax(bowl_positions[:, 1])\n","top_bowl_name = bowl_names[top_bowl_idx]\n","ret_val = top_bowl_name\n","'''.strip()"],"metadata":{"id":"aFCmJAq8A6QE"},"execution_count":null,"outputs":[]},{"cell_type":"code","source":["context_vars = {\n","    'np': np,\n","    'get_obj_pos': get_obj_pos\n","}\n","successes, pred_answers, resps = eval_questions_lmp(prompt_parse_obj_name_lmp, query_setting_short, questions_short, answers, context_vars)\n","print('Success Rate: ', np.mean(successes))\n","# print('Failures')\n","# for s, q, r, pa, a in zip(successes, questions_short, resps, pred_answers, answers):\n","#   if not s:\n","#     print(q)\n","#     print(r)\n","#     print(pa, a)\n","#     print()"],"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":66,"referenced_widgets":["7a90baba43fb4c8e89fb7dc3b0cdf3bd","946e16ab864d4bb08b038ad8e3b4ed3c","255e861f1f7e49aaba613e0d9bbe8b37","9ebb4687c2614c27826f0cca14796602","4c5c3c109f344154a72acd42b0e23c6a","5a7405f26611412a910686c353fd536f","806d8091e4e743f0a1eb5adc9354a4fb","ab2a9009d1d749fdba4aec615db13434","f5d599b06edb4619bae99a61816d1f1e","e705cb4b600144c29fa02434c294c05b","09bcc5ae2c084caca04d1266ed6722c9"]},"id":"_RCxtOJdEg3b","executionInfo":{"status":"ok","timestamp":1660578707095,"user_tz":240,"elapsed":19212,"user":{"displayName":"Jacky Liang","userId":"05524594537381871813"}},"outputId":"230690d6-19f7-4c1d-cc41-94972b448791"},"execution_count":null,"outputs":[{"output_type":"display_data","data":{"text/plain":["  0%|          | 0/2 [00:00<?, ?it/s]"],"application/vnd.jupyter.widget-view+json":{"version_major":2,"version_minor":0,"model_id":"7a90baba43fb4c8e89fb7dc3b0cdf3bd"}},"metadata":{}},{"output_type":"stream","name":"stdout","text":["Success Rate:  0.9642857142857143\n"]}]},{"cell_type":"markdown","source":["# Task: Select Positions by Spatial Descriptions"],"metadata":{"id":"Dk-fqBbXwJYC"}},{"cell_type":"markdown","source":["## Setup"],"metadata":{"id":"INz-qXHe1tJA"}},{"cell_type":"code","source":["def get_corners():\n","  return np.array([[0,0], [1, 0], [1,1], [0,1]])\n","\n","def get_sides():\n","  return np.array([[0.5, 0], [0, 0.5], [1, 0.5], [0.5, 1]])\n","\n","def get_obj_pos(name):\n","  return {\n","      'cyan bowl': np.array([0.6, 0.2]),\n","      'red bowl': np.array((0.2, 0.7)),\n","      'blue bowl': np.array((0.7, 0.6)),\n","      'red block': np.array((0.4, 0.25)),\n","      'cyan block': np.array((0.1, 0.8)),\n","      'blue block': np.array((0.3, 0.2)),\n","  }[name]\n","\n","questions_short = [\n","    'a point 0.1 left of the cyan bowl',\n","    'a point 0.2 right of the red block',\n","    'a point 0.4 top of the blue bowl',\n","    'a point 0.1 bottom of the blue block',\n","\n","    'the corner closest to the red block',\n","    'the corner closest to the blue bowl',\n","    'the corner farthest from the cyan block',\n","    'the corner farthest from the red bowl',\n","\n","    'the side closest to the red block',\n","    'the side closest to the blue bowl',\n","    'the side farthest from the cyan block',\n","    'the side farthest from the red bowl',\n","\n","    'a circle with 10 points centered around the red block with radius 0.2',\n","    'a circle with 12 points centered around the blue bowl with radius 0.3',\n","\n","    'a line with 4 points from the top left corner to the bottom right corner',\n","    'a line with 5 points from the blue bowl to its closest side',\n","    'a line with 3 points from the blue block to its closest corner',\n","    'a line with 3 points from the middle to the red bowl',\n","    \n","    'a point in the middle of the red and blue blocks',\n","    'a point in the middle of the blue bowl and the corner closest to it',\n","    'a point in the middle between the top left corner and the bottom side',\n","\n","    'a point in the middle of the blue, red, and cyan blocks',\n","    'a point in the middle of the blue, red, and cyan bowls',    \n","]\n","\n","questions = [\n","    f'Find: {question_short}.' for question_short in questions_short\n","]\n","\n","circ_red_block = Point(get_obj_pos('red block')).buffer(0.2)\n","circ_blue_bowl = Point(get_obj_pos('blue bowl')).buffer(0.3)\n","square_cyan_bowl = box(\n","    get_obj_pos('cyan bowl')[0] - 0.05, get_obj_pos('cyan bowl')[1] - 0.05,\n","    get_obj_pos('cyan bowl')[0] + 0.05, get_obj_pos('cyan bowl')[1] + 0.05,\n","  )\n","\n","answers = [\n","    get_obj_pos('cyan bowl') + [-0.1, 0],\n","    get_obj_pos('red block') + [0.2, 0],\n","    get_obj_pos('blue bowl') + [0, 0.4],\n","    get_obj_pos('blue block') + [0, -0.1],\n","\n","    np.array([0, 0]),\n","    np.array([1, 1]),\n","    np.array([1, 0]),\n","    np.array([1, 0]),\n","\n","    np.array([0.5, 0]),\n","    np.array([1, 0.5]),\n","    np.array([1, 0.5]),\n","    np.array([1, 0.5]),\n","\n","    np.array([circ_red_block.exterior.interpolate(t / 9, normalized=True).coords[0] for t in range(10)]),\n","    np.array([circ_red_block.exterior.interpolate(t / 11, normalized=True).coords[0] for t in range(12)]),\n","\n","    np.linspace([0, 1], [1, 0], 4),\n","    np.linspace(get_obj_pos('blue bowl'), [1, 0.5], 5),\n","    np.linspace(get_obj_pos('blue block'), [0, 0], 3),\n","    np.linspace([0.5, 0.5], get_obj_pos('red bowl'), 3),\n","\n","    (get_obj_pos('red block') + get_obj_pos('blue block')) / 2,\n","    (get_obj_pos('blue bowl') + np.array([1, 1])) / 2,\n","    (np.array([0, 1]) + np.array([0.5, 0])) / 2,\n","\n","    (get_obj_pos('red block') + get_obj_pos('blue block') + get_obj_pos('cyan block')) / 3,\n","    (get_obj_pos('red bowl') + get_obj_pos('blue bowl') + get_obj_pos('cyan bowl')) / 3\n","]\n","\n","def eval_questions_language(prompt, questions, answers):\n","  resps = lmp_batch(\n","      prompt,\n","      questions,\n","      strip=True,\n","      stop_tokens=['Setting: ', 'Find: '],\n","  )\n","  successes = []\n","  pred_answers = []\n","  for resp, answer in zip(resps, answers):\n","    pred_answer_str = resp[resp.find('Answer: ') + len('Answer: '):]\n","    try:\n","      pred_answer = np.array(eval_safe(pred_answer_str))\n","      success = np.allclose(pred_answer, answer, atol=1e-2)\n","    except Exception as e:\n","      print(e)\n","      success = False\n","\n","    successes.append(success)\n","    pred_answers.append(pred_answer_str)\n","  return successes, pred_answers, resps\n","\n","def eval_questions_lmp(prompt_f_gen, prompt, questions_short, answers, context_vars):\n","  queries = [\n","      f'\\n# {question}.'\n","      for question in questions_short\n","  ]\n","  resps = lmp_batch(\n","      prompt,\n","      queries,\n","      strip=True,\n","      stop_tokens=['objects = [', '#']\n","  )\n","\n","  new_fs = {}\n","  pred_answers = []\n","  for resp in resps:\n","    all_vars = merge_dicts([context_vars, new_fs])\n","    new_fs.update(create_new_fs_from_code(prompt_f_gen, resp, all_vars))\n","    \n","    all_vars = merge_dicts([context_vars, new_fs])\n","    lvars = {}\n","    exec_safe(resp, all_vars, lvars)\n","    \n","    pred_answers.append(lvars['ret_val'])\n","\n","  successes = []\n","  for resp, answer, pred_answer in zip(resps, answers, pred_answers):\n","    success = False\n","    try: \n","      np.allclose(answer, pred_answer)\n","      success = True\n","    except Exception as e:\n","      print(e)\n","    successes.append(success)\n","  return successes, pred_answers, resps"],"metadata":{"id":"eMEE0U_qxmXU"},"execution_count":null,"outputs":[]},{"cell_type":"code","source":["print(len(questions_short))"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"D26tqcQmgEEi","executionInfo":{"status":"ok","timestamp":1660668817586,"user_tz":240,"elapsed":124,"user":{"displayName":"Jacky Liang","userId":"05524594537381871813"}},"outputId":"11310666-c859-4f7d-bcd5-4f5f7de54273"},"execution_count":null,"outputs":[{"output_type":"stream","name":"stdout","text":["23\n"]}]},{"cell_type":"markdown","source":["## Direct Language"],"metadata":{"id":"dH1JxOr6jF4S"}},{"cell_type":"code","source":["prompt_parse_pos_nl = '''\n","Setting: Objects and their positions are: \n","  - cyan bowl, (0.6, 0.2)\n","  - red bowl, (0.2, 0.7)\n","  - blue bowl, (0.7, 0.6)\n","  - red block, (0.4, 0.25)\n","  - cyan block, (0.1, 0.8)\n","  - blue block, (0.3, 0.2)\n","Setting: The four corner names and their positions are:\n","  - top left corner, (0, 1)\n","  - top right corner, (1, 1)\n","  - bottom left corner, (0, 0)\n","  - bottom right corner, (1, 0)\n","Setting: The four side names and their positions are:\n","  - top side, (0.5, 1)\n","  - right side, (1, 0.5)\n","  - bottom side, (0.5, 0)\n","  - left side, (0, 0.5)\n","Find: the top right corner.\n","Answer: (1, 1)\n","Find: the bottom side.\n","Answer: (0.5, 0)\n","Find: a point 0.1 right of the red bowl.\n","Answer: (0.3, 0.7)\n","Find: a line with 3 points from the blue block to the bottom right corner.\n","Answer: ((0.3, 0.2), (0.65, 0.1), (1, 0))\n","Find: a circle with 10 points around the center with radius 0.1.\n","Answer: ((0.6, 0.5), (0.577, 0.436), (0.517, 0.402), (0.450, 0.413), (0.406, 0.466), (0.406, 0.534), (0.450, 0.587), (0.517, 0.598), (0.577, 0.564), (0.6, 0.5))\n","Find: a loop that goes through all the sides.\n","Answer: ((0.5, 0), (0, 0.5), (1, 0.5), (0.5, 1), (0.5, 0))\n","'''"],"metadata":{"id":"iYGKLVZdjKT4"},"execution_count":null,"outputs":[]},{"cell_type":"code","source":["successes, pred_answers, resps = eval_questions_language(prompt_parse_pos_nl, questions, answers)\n","print('Success Rate: ', np.mean(successes))\n","# print('Failures')\n","# for s, q, r, pa, a in zip(successes, questions_short, resps, pred_answers, answers):\n","#   if not s:\n","#     print(q)\n","#     print(r)\n","#     print(pa, a)\n","#     print()"],"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":101,"referenced_widgets":["39117492fa5641e5b4891091d335f459","c304de8a1b00441cb23e53df92a439c9","7d186b73c8544b1fbea1f261757cdcf5","1e4f1fc2acb6442a9222b62e9c7e0646","43ab3edf9e6b44f49e0991a191508e5f","73bad1a2113a472b80c6097ef975dad0","0b446c49d9ad47a0a21fbe521c87fc7e","e49b61488f9d48308239976aa49a7745","ff111b88dfd6436dacd3b5e812a73a94","68f0b6cf2c184261ad2f75485d805cca","0bb9cd7927484b92b6981f494ce8f447"]},"id":"OOAIgERikBuy","executionInfo":{"status":"ok","timestamp":1660669828662,"user_tz":240,"elapsed":14957,"user":{"displayName":"Jacky Liang","userId":"05524594537381871813"}},"outputId":"0be628a6-d54a-483f-aa48-9cab94b495d6"},"execution_count":null,"outputs":[{"output_type":"display_data","data":{"text/plain":["  0%|          | 0/2 [00:00<?, ?it/s]"],"application/vnd.jupyter.widget-view+json":{"version_major":2,"version_minor":0,"model_id":"39117492fa5641e5b4891091d335f459"}},"metadata":{}},{"output_type":"stream","name":"stdout","text":["operands could not be broadcast together with shapes (9,2) (10,2) \n","operands could not be broadcast together with shapes (5,2) (4,2) \n","Success Rate:  0.30434782608695654\n"]}]},{"cell_type":"markdown","source":["## Chain of Thought"],"metadata":{"id":"DAgL8Qw4jKbD"}},{"cell_type":"code","source":["prompt_parse_pos_cot = '''\n","Setting: Objects and their positions are: \n","  - cyan bowl, (0.6, 0.2)\n","  - red bowl, (0.2, 0.7)\n","  - blue bowl, (0.7, 0.6)\n","  - red block, (0.4, 0.25)\n","  - cyan block, (0.1, 0.8)\n","  - blue block, (0.3, 0.2)\n","Setting: The four corner names and their positions are:\n","  - top left corner, (0, 1)\n","  - top right corner, (1, 1)\n","  - bottom left corner, (0, 0)\n","  - bottom right corner, (1, 0)\n","Setting: The four side names and their positions are:\n","  - top side, (0.5, 1)\n","  - right side, (1, 0.5)\n","  - bottom side, (0.5, 0)\n","  - left side, (0, 0.5)\n","Find: the top right corner.\n","Answer: (1, 1)\n","Find: the bottom side.\n","Answer: (0.5, 0)\n","Find: a point 0.1 right of the red bowl.\n","Thought: The red bowl position is (0.2, 0.7).\n","Thought: (0.2, 0.7) + (0.1, 0) = (0.3, 0.7)\n","Answer: (0.3, 0.7)\n","Find: a line with 3 points from the blue block to the bottom right corner.\n","Thought: The start position is (0.3, 0.2).\n","Thought: The end position is (1, 0).\n","Thought: Interpolating one point in the middle is ((0.3, 0.2) + (1, 0)) / 2 = (0.65, 0.1)\n","Answer: ((0.3, 0.2), (0.65, 0.1), (1, 0))\n","Find: a circle with 10 points around the center with radius 0.1.\n","Thought: The center position is (0.5, 0.5).\n","Thought: The first and last point on the circle is (0.5, 0.5) + (0.1, 0) = (0.6, 0.5).\n","Thought: Other points are obtained by applying increments of 360/10 = 36 degrees.\n","Answer: ((0.6, 0.5), (0.577, 0.436), (0.517, 0.402), (0.450, 0.413), (0.406, 0.466), (0.406, 0.534), (0.450, 0.587), (0.517, 0.598), (0.577, 0.564), (0.6, 0.5))\n","Find: a loop that goes through all the sides.\n","Thought: The sides are ((0.5, 1), (1, 0.5), (0.5, 0), (0, 0.5)).\n","Thought: A loop is a sequence that needs the first position in the last position.\n","Answer: ((0.5, 1), (1, 0.5), (0.5, 0), (0, 0.5), (0.5, 1))\n","'''"],"metadata":{"id":"LKos8CUVjLdP"},"execution_count":null,"outputs":[]},{"cell_type":"code","source":["successes, pred_answers, resps = eval_questions_language(prompt_parse_pos_cot, questions, answers)\n","print('Success Rate: ', np.mean(successes))\n","# print('Failures')\n","# for s, q, r, pa, a in zip(successes, questions_short, resps, pred_answers, answers):\n","#   if not s:\n","#     print(q)\n","#     print(r)\n","#     print(pa, a)\n","#     print()"],"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":84,"referenced_widgets":["32f4011005b14486bdeccf2603e28981","43fe80b069814cc38e8e0fcf3128dd8e","97686f39da2441d590fe2c33f4849aa6","cb764eda4d984f1ea05b58b5e2af4f2c","c0b8ce66baf64dc7a4e07d42e753ae75","f92df179ceb541fc8db4d70419130209","e8ade12c33b64816af58f1b073fca8ac","67fca3f587be4150af4a56b2f6abfacb","e6f2884f826746c7bda751b272ad5842","6e2ea7cfb28d40c59e3d0b26660cbd61","e7ac3fd64a15441aa9eb93e7aab91e04"]},"id":"ztzg3JKkowvk","executionInfo":{"status":"ok","timestamp":1660670189361,"user_tz":240,"elapsed":23294,"user":{"displayName":"Jacky Liang","userId":"05524594537381871813"}},"outputId":"b7de7731-1084-4e1b-8685-99ae4e21c5b1"},"execution_count":null,"outputs":[{"output_type":"display_data","data":{"text/plain":["  0%|          | 0/2 [00:00<?, ?it/s]"],"application/vnd.jupyter.widget-view+json":{"version_major":2,"version_minor":0,"model_id":"32f4011005b14486bdeccf2603e28981"}},"metadata":{}},{"output_type":"stream","name":"stdout","text":["operands could not be broadcast together with shapes (19,2) (12,2) \n","Success Rate:  0.4782608695652174\n"]}]},{"cell_type":"markdown","source":["## LMP"],"metadata":{"id":"pYU9eVJg1uFM"}},{"cell_type":"code","source":["import shapely\n","from shapely.geometry import *\n","from shapely.affinity import *\n","\n","prompt_f_gen = '''\n","import numpy as np\n","from shapely.geometry import *\n","from shapely.affinity import *\n","\n","# define function: pt_np = move_pt_left(pt_np, dist).\n","def move_pt_left(pt_np, dist):\n","    delta = np.array([-dist, 0])\n","    return translate_pt_np(pt_np, delta=delta)\n","\n","# define function: pt_np = move_pt_up(pt_np, dist).\n","def move_pt_up(pt_np, dist):\n","    delta = np.array([0, dist])\n","    return translate_pt_np(pt_np, delta=delta)\n","\n","# example: interpolate a line at the halfway point.\n","pt = np.array(line.interpolate(t, normalized=True).coords[0])\n","'''.strip()\n","\n","prompt_parse_positions = '''\n","import numpy as np\n","from shapely.geometry import *\n","from shapely.affinity import *\n","from utils import get_obj_pos, get_corners, get_sides\n","\n","# the top right corner.\n","top_left_pos = np.array([0, 1])\n","ret_val = top_left_pos\n","# the bottom side.\n","bottom_pos = np.array([0.5, 0])\n","ret_val = bottom_pos\n","# point 0.1 right of the red bowl.\n","ret_val = get_obj_pos('red bowl') + [0.1, 0]\n","# a line with 3 points from the blue block to the bottom right corner.\n","start_pos = get_obj_pos('blue block')\n","end_pos = np.array([1, 0])\n","line = make_line(start=start_pos, end=end_pos)\n","points_np = interpolate_pts_on_line(line=line, n=3)\n","ret_val = points_np\n","# a circle with 10 points around the center with radius 0.1.\n","circle = make_circle(center=np.array([0.5, 0.5]), radius=0.1)\n","pts_coords = interpolate_pts_along_exterior(exterior=circle.exterior, n=10)\n","ret_val = pts_coords\n","# loop that goes through all the sides.\n","sides = get_sides()\n","loop = np.r_[sides, [sides[0]]]\n","ret_val = loop\n","'''.strip()\n","\n","context_vars = {\n","    'np': np,\n","    'get_corners': get_corners,\n","    'get_sides': get_sides,\n","    'get_obj_pos': get_obj_pos\n","}\n","context_vars.update({\n","    name: getattr(shapely.geometry, name)\n","    for name in shapely.geometry.__all__\n","})\n","context_vars.update({\n","    name: getattr(shapely.affinity, name)\n","    for name in shapely.affinity.__all__\n","})"],"metadata":{"id":"VBn19jZqjU4M"},"execution_count":null,"outputs":[]},{"cell_type":"code","source":["successes, pred_answers, resps = eval_questions_lmp(prompt_f_gen, prompt_parse_positions, questions_short, answers, context_vars)\n","print('Success Rate: ', np.mean(successes))\n","# print('Failures')\n","# for s, q, r, pa, a in zip(successes, questions_short, resps, pred_answers, answers):\n","#   if not s:\n","#     print(q)\n","#     print(r)\n","#     print(pa, a)\n","#     print()"],"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":900,"referenced_widgets":["b0561d4d8fc24dc7be9ec7fc8344dd6f","5ada3ad570da45b5b6670b930975c9ed","60b43948dd83429b9c2fca2f4dddeab8","5f9df26f553749729e1247be660012c7","c3ca95c367f84e1b9ba15f44c57eaf52","78243a6142284aff86746a3d8ae35a98","1be9e09560964f0a8255c6d9c0848c45","c4038bf5c6674e27ab3993b81c439dc6","ec703d0f31e54cb9a68e7fbecdec40a9","0a96aa3995154ceabd1efb7d06c2684a","96c94911cbfa43f9b846296ca82959e9"]},"id":"EzT8fJVry1o4","executionInfo":{"status":"ok","timestamp":1660668302565,"user_tz":240,"elapsed":30425,"user":{"displayName":"Jacky Liang","userId":"05524594537381871813"}},"outputId":"5c305763-3376-4a87-e73a-39725de6dabb"},"execution_count":null,"outputs":[{"output_type":"display_data","data":{"text/plain":["  0%|          | 0/2 [00:00<?, ?it/s]"],"application/vnd.jupyter.widget-view+json":{"version_major":2,"version_minor":0,"model_id":"b0561d4d8fc24dc7be9ec7fc8344dd6f"}},"metadata":{}},{"output_type":"stream","name":"stdout","text":["LMP FGEN created:\n","\n","\u001b[37m# define function: circle = make_circle(center=red_block_pos, radius=0.2).\u001b[39;49;00m\n","\u001b[34mdef\u001b[39;49;00m \u001b[32mmake_circle\u001b[39;49;00m(center, radius):\n","    \u001b[34mreturn\u001b[39;49;00m Point(center).buffer(radius)\n","\n","\n","LMP FGEN created:\n","\n","\u001b[37m# define function: pts_coords = interpolate_pts_along_exterior(exterior=circle.exterior, n=10).\u001b[39;49;00m\n","\u001b[34mdef\u001b[39;49;00m \u001b[32minterpolate_pts_along_exterior\u001b[39;49;00m(exterior, n):\n","    pts_coords = []\n","    \u001b[34mfor\u001b[39;49;00m i \u001b[35min\u001b[39;49;00m \u001b[36mrange\u001b[39;49;00m(n):\n","        t = i / (n - \u001b[34m1\u001b[39;49;00m)\n","        pt = np.array(exterior.interpolate(t, normalized=\u001b[34mTrue\u001b[39;49;00m).coords[\u001b[34m0\u001b[39;49;00m])\n","        pts_coords.append(pt)\n","    \u001b[34mreturn\u001b[39;49;00m pts_coords\n","\n","\n","LMP FGEN created:\n","\n","\u001b[37m# define function: line = make_line(start=start_pos, end=end_pos).\u001b[39;49;00m\n","\u001b[34mdef\u001b[39;49;00m \u001b[32mmake_line\u001b[39;49;00m(start, end):\n","    \u001b[34mreturn\u001b[39;49;00m LineString([start, end])\n","\n","\n","LMP FGEN created:\n","\n","\u001b[37m# define function: points_np = interpolate_pts_on_line(line=line, n=4).\u001b[39;49;00m\n","\u001b[34mdef\u001b[39;49;00m \u001b[32minterpolate_pts_on_line\u001b[39;49;00m(line, n):\n","    pts = []\n","    \u001b[34mfor\u001b[39;49;00m i \u001b[35min\u001b[39;49;00m \u001b[36mrange\u001b[39;49;00m(n):\n","        t = i / (n - \u001b[34m1\u001b[39;49;00m)\n","        pt = np.array(line.interpolate(t, normalized=\u001b[34mTrue\u001b[39;49;00m).coords[\u001b[34m0\u001b[39;49;00m])\n","        pts.append(pt)\n","    \u001b[34mreturn\u001b[39;49;00m np.array(pts)\n","\n","\n","LMP FGEN created:\n","\n","\u001b[37m# define function: end_pos = get_closest_side(start_pos).\u001b[39;49;00m\n","\u001b[34mdef\u001b[39;49;00m \u001b[32mget_closest_side\u001b[39;49;00m(start_pos):\n","    \u001b[34mif\u001b[39;49;00m start_pos[\u001b[34m0\u001b[39;49;00m] < \u001b[34m0.5\u001b[39;49;00m:\n","        \u001b[34mreturn\u001b[39;49;00m np.array([\u001b[34m0\u001b[39;49;00m, start_pos[\u001b[34m1\u001b[39;49;00m]])\n","    \u001b[34melse\u001b[39;49;00m:\n","        \u001b[34mreturn\u001b[39;49;00m np.array([\u001b[34m1\u001b[39;49;00m, start_pos[\u001b[34m1\u001b[39;49;00m]])\n","\n","\n","Success Rate:  1.0\n"]}]}]}